<!-- Generated automatically at 11/04/2011 -->
<div id="advertisement-new">
	<div class="header">Đăng tin</div>
	<div class="content">
<!-- Begin main form -->
    	<form name="new-form" id="new-form" method="post">
    		<table id="table-new-form">
<!-- Begin type -->   
    			<tr class="field">
    				<td class="label">
    					<label for="type">Loại tin</label>
    				</td>
    				<td class="input">
    					<?php echo htmlGenRadioBox('offer', 'type', 'Cung cấp', 'offer', $isOffer) ?>
    					<?php echo htmlGenRadioBox('demand', 'type', 'Tìm kiếm', 'demand', $isDemand) ?>
    				</td>
    			</tr>
    			<tr>
    				<td></td>
    				<td>
    			    <?php if(isset($formErrors['type'])) echo "<div class='error' >".$formErrors['type']."</div>" ?>
    				</td>
    			</tr>
<!-- End type -->   	
    			
<!-- Begin category -->   			
    			<tr class="field">
    				<td class="label">
    					<label for="categoryId">Danh mục</label>
    				</td>
    				<td class="input">
    					<?php echo htmlGenSelectBox('categoryId', 'categoryId', '', $categoriesCached, $formData['categoryId'], true, true, true) ?>
    				</td>
    			</tr>
    			<tr>
    				<td></td>
    				<td>
    			    <?php if(isset($formErrors['category'])) echo "<div class='error' >".$formErrors['category']."</div>" ?>
    				</td>
    			</tr>
<!-- End category --> 

<!-- Begin town --> 	
    			<tr class="field">
    				<td class="label">
    					<label for="town">Thành phố</label>
    				</td>
    				<td class="input">
							<?php echo htmlGenTextBox('town', 'town', '', $formData['town'], '45px', true) ?>
    				</td>
    			</tr>

					<tr>
						<td></td>
						<td>
							<div class="note">*Bạn gõ vài chữ cái tương ứng với thành phố của bạn rồi chọn trong danh sách thành phố tương ứng.</div>
							<?php if(isset($formErrors['town'])) echo "<div class='error' >".$formErrors['town']."</div>" ?>
						</td>
					<tr>
<!-- End town --> 

<!-- Begin name -->
    			<tr class="field">
    				<td class="label">
    					<label for="name">Người đăng</label>
    				</td>
    				<td class="input">
    				  <?php echo htmlGenTextBox('name', 'name', '', $formData['name'], '20px', true) ?>
    				</td>
    			</tr>
    			<tr>
						<td></td>
						<td>
							<?php if(isset($formErrors['name'])) echo "<div class='error' >".$formErrors['name']."</div>" ?>
						</td>
					<tr>
<!-- End name -->
    			
<!-- Begin email -->        			
    			<tr class="field">
    				<td class="label">
    					<label for="email">Email</label>
    				</td>
    				<td class="input">
    					<?php echo htmlGenTextBox('email', 'email', '', $formData['email'], '30px', true) ?>
    				</td>
    			</tr>
    			<tr>
						<td></td>
						<td>
							<?php if(isset($formErrors['email'])) echo "<div class='error' >".$formErrors['email']."</div>" ?>
						</td>
					<tr>
<!-- End email -->    

<!-- Begin telephone -->    			
    			<tr class="field">
    				<td class="label">
    					<label for="telephone">Điện thoại</label>
    				</td>
    				<td class="input">
    					<?php echo htmlGenTextBox('telephone', 'telephone', '', $formData['telephone'], '11px', true) ?>
    					<span class="note">*Không bắt buộc.</span>
    				</td>
    			</tr>
    			
    			<tr>
    				<td></td>
    				<td>
    			    <?php if(isset($formErrors['telephone'])) echo "<div class='error' >".$formErrors['telephone']."</div>" ?>
    				</td>
    			</tr>
<!-- End telephone -->

<!-- Begin title -->     			
    			<tr class="field">
    				<td class="label">
    					<label for="title">Tiêu đề</label>
    				</td>
    				<td class="input">
    					<?php echo htmlGenTextBox('title', 'title', '', $formData['title'], '50px', true) ?>
    				</td>
    			</tr>
    			
    			<tr>
    			  <td></td>
    				<td>
    					<div class="note">Tiêu đề tối đa <?php echo MAX_LENGTH_AD_TITLE ?> kí tự.</div>
    					<?php if(isset($formErrors['title'])) echo "<div class='error'>".$formErrors['title']."</div>" ?>
    				</td>
    			</tr>
<!-- Begin title --> 

<!-- Begin description -->    			
    			<tr class="field">
    				<td class="label">
    					<label for="description">Nội dung</label>
    				</td>
    				<td class="input">
    					<?php echo htmlGenTextArea('description', 'description', '', $formData['description'], 10, 58, true) ?>
    				</td>
    			</tr>
    			
    			<tr>
    			  <td></td>
    				<td>
    			    <?php if(isset($formErrors['description'])) echo "<div class='error'>".$formErrors['description']."</div>" ?>
    				</td>
    			</tr>
<!-- End description --> 

<!-- Begin price -->   			
    			<tr class="field">
    				<td class="label">
    					<label for="price">Giá</label>
    				</td>
    				<td class="input">
        		  <?php echo htmlGenTextBox('price', 'price', '', $formData['price'], '5px', true) ?> €
        			<span class="note">*Không bắt buộc.</span>
    				</td>
    			</tr>
    			
    			<tr>
    			  <td></td>
    				<td>
    				  <div class="note">*Giá tiền phải là số nguyên.</div>
        		  <?php if(isset($formErrors['price'])) echo "<div class='error'>".$formErrors['price']."</div>" ?>
    				</td>
    			</tr>
<!-- End price -->  

<!-- Begin photos -->  
        	<tr class="field">
  					<td class="label"></td>
  					<td class="input">
          		<span id="photos"><?php echo $photosData ?></span>
          		<span id="upload-loading"></span>
          		<div id="note-delete-photo" class="note"><?php echo $noteDeletePhoto ?></div>
  					</td>
  				</tr>
<!-- End photos --> 

      		<?php echo htmlGenHiddenField('action', 'action', 'new') ?>
			</table>
		</form>

<!-- End main form -->	

<!-- Begin photo form -->		
		<table id="table-upload-form">	
				<tr class="field">
					<td class="label">
						<label for="photo">Ảnh</label>
					</td>
					<td class="input">
						<form target="iframe-upload-photo" action="/exec/upload.exec.php" id="upload-photo-form" enctype="multipart/form-data" method="post">
							<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MAX_SIZE_PHOTO_UPLOAD ?>" />
		      		<?php echo htmlGenFileInputBox('photo', 'photo', '', '', 30, true) ?>
							<span class="note">*Không bắt buộc.</span>
						</form>
					</td>
				</tr>
  			<tr>
  			  <td></td>
  				<td>
  				  <div class="note">*Kích thước file ảnh tối đa là <?php echo MAX_SIZE_PHOTO_UPLOAD/1000 ?> Kb.</div>
      		  <div class="error" id="upload-photo-error"></div>
  				</td>
  			</tr>
<!-- End photo form -->		

<!-- Begin submit button -->					
  			<tr class="field">
  				<td class="input" colspan="2" align="center">
			      <iframe id="iframe-upload-photo" name="iframe-upload-photo" style="width: 0px;height: 0px;border:0px;"></iframe>
            <?php echo htmlGenButton('btn-submit', 'btn-submit', 'Đăng tin') ?>
          </td>
  			</tr>
  		</table>
<!-- End submit button -->	
	</div>
</div>
